# coding=utf-8
import re
 
S = 'ABCDEFGHIJKLMNOPRSTUVWXY'
T = '222333444555666777888999'
 
 
def clean(s):
    s = re.sub(r'\W|Q|Z', '', s)
    s = s.translate(str.maketrans(S, T))
    return s[0:3] + '-' + s[3:]
 
 
if __name__ == '__main__':
    D = {}
    for i in range(int(input())):
        s = clean(input())
        if s in D:
            D[s] += 1
        else:
            D[s] = 1
 
    duplicate = False
    for key in sorted(D.keys()):
        if D[key] == 1: continue
        print(key, D[key])
        duplicate = True
    if not duplicate:
        print('No duplicates.')